import React, { useState } from 'react';
import { LoadingContext } from './context';

const LoadingProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
  const [isLoading, setIsLoading] = useState(false);

  const setLoading = (isShow: boolean) => setIsLoading(isShow);

  return (
    <LoadingContext.Provider value={{ isLoading, setLoading }}>
      {children}
    </LoadingContext.Provider>
  );
};
export default LoadingProvider;